package br.com.musclebook.bean;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

import org.primefaces.extensions.model.layout.LayoutOptions;

import br.com.musclebook.enums.ExerciseCategory;
import br.com.musclebook.enums.RoutineIntensity;

@Named
@ApplicationScoped
public class ApplicationBean implements Serializable {

    private static final long serialVersionUID = 1L;
    
    private LayoutOptions layoutOptions;
    
    @PostConstruct
    public void init() {
	this.layoutOptions = new LayoutOptions();
	
	// options for all panes  
        LayoutOptions panes = new LayoutOptions();  
        panes.addOption("slidable", false);  
        layoutOptions.setPanesOptions(panes);
        
        // north pane  
        LayoutOptions north = new LayoutOptions();  
        north.addOption("size", 45);  
        north.addOption("resizable", false);  
        north.addOption("closable", false);  
        north.addOption("spacing_open", 0);  
        
        // west pane  
        LayoutOptions west = new LayoutOptions();  
        west.addOption("size", 200);  
        west.addOption("resizable", false);  
        west.addOption("spacing_open", 6);
        
        // east pane  
        LayoutOptions east = new LayoutOptions();  
        east.addOption("size", 252);  
        east.addOption("resizable", false);  
        east.addOption("spacing_open", 0);
 
        layoutOptions.setNorthOptions(north);
        layoutOptions.setWestOptions(west);
        layoutOptions.setEastOptions(east);
    }
    
    public List<ExerciseCategory> getExerciseCategories() {
	return Arrays.asList(ExerciseCategory.values());
    }
    
    public List<RoutineIntensity> getRoutineIntensities() {
	return Arrays.asList(RoutineIntensity.values());
    }

    public LayoutOptions getLayoutOptions() {
        return layoutOptions;
    }
    
    public Locale getDefaultLocale() {
	return Locale.getDefault();
    }
    
    public TimeZone getDefaultTimeZone() {
	return TimeZone.getDefault();
    }

}
